﻿using System.Web.Mvc;
using WroxBlog.Models.Interfaces;

namespace WroxBlog.Controllers
{
    public class HomeController : Controller
    {
        private IBlogRepository _blogRepository;
        private IPostRepository _postRepository;
        private ICategoryRepository _categoryRepository;

        public HomeController(IBlogRepository blogRepository,
            IPostRepository postRepository, ICategoryRepository categoryRepository)
        {
            this._blogRepository = blogRepository;
            this._postRepository = postRepository;
            this._categoryRepository = categoryRepository;
        }

        public ActionResult Index()
        {
            ViewData["Categories"] = this._categoryRepository.GetCategories();
            ViewData["Posts"] = this._postRepository.GetRecentPosts(10);

            return View();
        }

        public ActionResult About()
        {
            ViewData["AboutText"] = this._blogRepository.GetAboutText();

            return View();
        }
    }
}
